package swap2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-06-29
 * Time: 10:33
 */
class Myvalue{
    public int val;
    public static void fu(){
        System.out.println("123");
    }
}
public class Test {
    public static void swap(Myvalue myvalue1,Myvalue myvalue2){
        int tmp = myvalue1.val;
        myvalue1.val = myvalue2.val;
        myvalue2.val = tmp;
    }
    public static void main(String[] args) {
        Myvalue myvalue1 = new Myvalue();
        myvalue1.val = 10;
        Myvalue myvalue2 = new Myvalue();
        myvalue2.val = 20;
        System.out.println("交换前"+myvalue1.val+myvalue2.val);
        swap(myvalue1,myvalue2);
        System.out.println("交换后"+myvalue1.val+myvalue2.val);
        Myvalue.fu();

    }

}
